<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<script src="https://cdn.bootcdn.net/ajax/libs/axios/1.8.4/axios.js"></script>
</head>
<body>

</body>
<script>
	const customAxios = axios.create()
	
	customAxios.interceptors.response.use(
		response => response,
		error => {
			const config = error.config
			if (error.code === "ECONNABORTED" && error.message.indexOf('timeout') > -1){
				if (config.currentTimes === undefined){
					config.currentTimes = 1
				}
				if (config.currentTimes <= config.retryTimes){
					config.currentTimes++
					return customAxios.request(config)
				}
			}
			return Promise.reject(error)
		}
	)
	
	function sendRequest(){
		customAxios.get('http://localhost:3000/timeout',{
			timeout: 4000,
			retryTimes: 3
		}).then(res=>{
			console.log(res)
		})
	}
	sendRequest()
</script>
</html>